import {Component} from 'react'

export default  class extends Component{

     state={
        datas:[] 
     }
     
     componentDidMount(){
     let datas=[{id:1,name:"张三",age:19}, 
         {id:2,name:"李四",age:19}, 
         {id:3,name:"王五",age:20}, 
         {id:4,name:"赵柳",age:25}, 
         {id:5,name:"孙琦",age:21}, 
         {id:6,name:"王八绿",age:26}]

      this.setState({datas})   
     }


    render(){
        return(
            <div>
                <div>
                    <label>学生姓名:</label>
                    <input type="text" placeholder='请输入姓名'/>
                </div>
                <div>
                    <label>年龄</label>
                    <input type="text" placeholder='请输入年龄'/>
                </div>
                 <div>
                     <button>添加</button>
                 </div>
              <ul>
                  {this.state.datas.map((item)=>{
                     return <li key={item.id}>编号:{item.id}---姓名:{item.name}--年龄:{item.age}</li>
                  })}  
             </ul>
            </div>
        )
    }
}
